﻿using Uber.Core;
using Uber.Core.Model;
using Uber.Core.Repository;
using Uber.Core.Service;

namespace Uber.Service
{
    public class Scams : IScams
    {
        private readonly IScamRepo repo;

        public Scams(IScamRepo repo)
        {
            this.repo = repo;
        }

        public void Good(long id)
        {
            repo.Delete(id);
        }

        public void NotGood(long id)
        {
            repo.Ban(id);
        }

        public IPageable<Scam> GetPage(int page, int pageSize)
        {
            return new Pageable<Scam>
            {
                PageIndex = page,
                Page = repo.GetPage(page, pageSize),
                PageCount = ServiceUtils.GetPageCount(pageSize, repo.GetCount())
            };
        }
    }
}